feat: Add Quadratic solver capabilities#109
Open
Shurikal wants to merge 8 commits into
Open
Conversation
…andling - Introduced `IntoQuadraticExpression` trait for converting various types (e.g., `Expression`, `Variable`, numeric constants) into quadratic expressions. - Removed the `QuadraticUnsolvedProblem` struct and integrated its functionality into the existing `UnsolvedProblem` struct. - Updated solvers (`clarabel`, `coin_cbc`, `lp_solve`, `microlp`) to handle quadratic objectives appropriately, with checks and panic messages for unsupported cases. - Refactored the `clarabel` solver to support both linear and quadratic objectives, consolidating the logic for building the objective matrix. - Enhanced the `ProblemVariables` struct with new methods for creating optimization problems with quadratic objectives. - Updated tests to validate the new quadratic functionality and ensure compatibility with existing linear problem-solving methods.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I added a first draft how quadratic solvers could be implemented. As an example I took the
clarabelsolver which is able to solve Quadratic Programs of the form:K is a composition of convex cones.
Currently only linear constraints are supported for the
clarabelquadratic solver.To enable the quadratic features, I added a flag called
enable_quadraticto not change the default behavior.I added some tests in
quadratic_solver_tests.rs.Full disclaimer, I used Claude to help me, because I'm not a good rust programmer...
If there are any suggestion how to improve this, I'm happy to implement them :) .